import Vue from 'vue';

Vue.directive('loadmore', {
    bind: function(el, binding) {
        const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown.el-popper.virtual-list .el-select-dropdown__wrap.el-scrollbar__wrap');
        const div = document.createElement('div');
        div.className = "visible-list"
        div.appendChild(SELECTWRAP_DOM.children[0])
        SELECTWRAP_DOM.appendChild(div)
        SELECTWRAP_DOM.addEventListener('scroll', function(e) {
            const firstIndex = Math.floor(e.target.scrollTop / 34);
            const secondIndex = firstIndex + 8;
            binding.value(firstIndex, secondIndex, e.target.scrollTop);
        })
        
    }
})